package com.winter.main.utils;

/**
 * Desc:
 * Author: dushuang
 * Date: Create in 2018/3/29
 */
public class ResponseModel {

    /*
    成功
     */
    public static int SUCCESE = 200;
    /*
    系统异常
     */
    public static int SYSTEM_ERROR = 500;
    /*
    参数异常
     */
    public static int CONDITHON_ERROR = 501;

    private int resultCode;

    private String message;

    private Object resultData;

    public int getResultCode() {
        return resultCode;
    }

    public void setResultCode(int resultCode) {
        this.resultCode = resultCode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getResultData() {
        return resultData;
    }

    public void setResultData(Object resultData) {
        this.resultData = resultData;
    }

    public ResponseModel ok(String msg){
        this.ok(msg, null);
        return this;
    }

    public ResponseModel ok(String msg, Object result){
        this.resultCode = ResponseModel.SUCCESE;
        this.message = msg;
        this.resultData = result;
        return this;
    }

    public ResponseModel conditionError(String msg){
        this.conditionError(msg, null);
        return this;
    }

    public ResponseModel conditionError(String msg, Object result){
        this.resultCode = ResponseModel.CONDITHON_ERROR;
        this.message = msg;
        this.resultData = result;
        return this;
    }

    public ResponseModel systemError(String msg){
        this.systemError(msg, null);
        return this;
    }

    public ResponseModel systemError(String msg, Object result){
        this.resultCode = ResponseModel.SYSTEM_ERROR;
        this.message = msg;
        this.resultData = result;
        return this;
    }

}
